/**
 * sql模板处理模块
 */
(function ($ns) {
    /**
     * 删除sql模板
     */
    $ns.deleteSqlTemplate = function (stid,status) {
        Qadmin.FW.Dialog.confirm({
            msg:'确定要删除记录？',
            ok:function () {
                Qadmin.FW.Ajax.get({
                    url:[QG_CONFIG.PATH + "sqltemplate/delete.htm?stid=", stid,"&status=",status].join("")
                }, function (xhr) {
                    location.reload();
                });
            }
        });
    };

    /**
     * 查看sql模板
     */
    $ns.getSqlTemplate = function (stid) {
        Qadmin.FW.Url.goToUrl(QG_CONFIG.PATH + "sqltemplate/get.htm?stid=" + stid);
    }

    /**
     * 更新sql模板
     */
    $ns.updateSqlTemplate = function (stid) {
        Qadmin.FW.Url.goToUrl(QG_CONFIG.PATH + "sqltemplate/update.htm?stid=" + stid);
    }

    /**
     * 执行sql模板
     */
    $ns.executeSqlTemplate = function (stid) {
        Qadmin.FW.Url.goToUrl(QG_CONFIG.PATH + "sqltemplate/execute.htm?stid=" + stid);
    }

    /**
     * 审核通过
     * */
    $ns.auditPassSqlTemplate = function (stid) {
        Qadmin.FW.Ajax.get({
            url:QG_CONFIG.PATH + "sqltemplate/auditPass.htm?stid=" + stid
        }, function (xhr) {
            location.reload();
        });
    }

    /**
     * 审核拒绝
     * */
    $ns.auditUnPassSqlTemplate = function (stid) {
        Qadmin.FW.Ajax.get({
            url:QG_CONFIG.PATH + "sqltemplate/auditUnPass.htm?stid=" + stid
        }, function (xhr) {
            location.reload();
        });
    }

    /**
     * 提交审核
     * */
    $ns.submitSqlTemplate = function (stid) {
        Qadmin.FW.Ajax.get({
            url:QG_CONFIG.PATH + "sqltemplate/submit.htm?stid=" + stid
        }, function (xhr) {
            location.reload();
        });
    }

})(using("Qadmin.App.SqlTemplate"));